import { utils } from "../../utils/CommonUtil";

export class HintData {

    /** 提示是否已经买过 存本地key + id*/
    public static  IS_HINT_UNLOCKED = "IS_HINT_UNLOCKED";  

    /** id*/
    public id:number;
    /** 所属关卡*/
    public levelId:number;
    /** 所属关卡的提示索引*/
    public hintIndex:number;
    /** 价格*/
    public price:number;

    public constructor(obj: string) {
        this.id = obj['id'];
        this.levelId = obj['levelId'];
        this.hintIndex = obj['hintIndex'];
        this.price = obj['price'];
    }

    /** 返回当前关卡是否解锁了*/
    public  IsUnlocked():boolean
    {
        return window.gameFacade.SDKMng.SDK.GetLocalData(HintData.IS_HINT_UNLOCKED+this.id) == "1";
    }

    /** 设置解锁*/
    public SetUnlocked( isUnlocked:boolean)
    {
        // if (isUnlocked)
        // {
        //     TalkingDataManager.Instance.TkEvent(TalkingDataManager.UNLOCK_HINT,id.ToString());
        // }
        // PlayerPrefsTool.SetBool(HintDataConst.IS_HINT_UNLOCKED + id,isUnlocked);
        window.gameFacade.SDKMng.SDK.SaveLocalData(HintData.IS_HINT_UNLOCKED+this.id,isUnlocked ? "1":"0");
    }
}